﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace GeoPal
{
    /// <summary>
    /// Class that represents the client's status
    /// </summary>
    public class Status
    {
        /// <summary>
        /// Represents the status of the network connection
        /// </summary>
        public enum ConnectionStatus
        {
            /// <summary>
            /// No network connection
            /// </summary>
            Disconnected,
            /// <summary>
            /// Connected to the network
            /// </summary>
            Connected,
            /// <summary>
            /// Traffic is ongoing
            /// </summary>
            Progress
        }
        /// <summary>
        /// Represents the status of the GPS receiver
        /// </summary>
        public enum GpsStatus
        {
            /// <summary>
            /// GPS receiver disabled
            /// </summary>
            Disabled,
            /// <summary>
            /// GPS receiver enabled, but the position is not fixed
            /// </summary>
            Enabled,
            /// <summary>
            /// GPS position fixed
            /// </summary>
            Fixed
        }
        /// <summary>
        /// Status message
        /// </summary>
        public string statusMessage = "Idle.";
        /// <summary>
        /// Status message font
        /// </summary>
        public Font statusFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular);
        /// <summary>
        /// Status message brush
        /// </summary>
        public Brush statusBrush = new SolidBrush(Color.Black);
        /// <summary>
        /// Status text placemark
        /// </summary>
        public Rectangle statusTextRectangle = new Rectangle(5, 16, 375, 25);
        /// <summary>
        /// GPS icon placemark
        /// </summary>
        public Rectangle statusIconGpsRectangle = new Rectangle(400, 12, 32, 32);
        /// <summary>
        /// Network icon placemark
        /// </summary>
        public Rectangle statusIconNetworkRectangle = new Rectangle(440, 12, 32, 32);
        public Icon iconGpsOk, iconGpsBad, iconNetworkOk, iconNetworkProgress, iconNetworkBad;
        public Image imageStatusBackground;
        /// <summary>
        /// Current connection status
        /// </summary>
        public ConnectionStatus connectionStatus;
        /// <summary>
        /// Current GPS status
        /// </summary>
        public GpsStatus gpsStatus;
        /// <summary>
        /// Constructor of the Status class (initializes default values)
        /// </summary>
        public Status()
        {
            connectionStatus = ConnectionStatus.Disconnected;
            gpsStatus = GpsStatus.Disabled;
            System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.Stream dataStream;
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.gps-ok.ico");
            iconGpsOk = new System.Drawing.Icon(dataStream);
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.gps-bad.ico");
            iconGpsBad = new System.Drawing.Icon(dataStream);
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.network-ok.ico");
            iconNetworkOk = new System.Drawing.Icon(dataStream);
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.network-progress.ico");
            iconNetworkProgress = new System.Drawing.Icon(dataStream);
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.network-bad.ico");
            iconNetworkBad = new System.Drawing.Icon(dataStream);
            dataStream = thisExe.GetManifestResourceStream("GeoPal.Resources.status-bg.jpg");
            imageStatusBackground = new System.Drawing.Bitmap(dataStream);
        }
    }
}
